yjx.controller('orgListController', ['$rootScope', '$scope', '$timeout', '$fetch', 'modalService', function ($rootScope, $scope, $timeout, $fetch, modalService) {
    var api = '/more/supplier';
    // $scope.orgList = [
    //     {
    //         id: 1,
    //         title: '光瀚集团',
    //         desc: '光瀚健康集团，致力于将基因检测技术服务于大众健康！光瀚健康集团，致力于将基因检测技术服务于大众健康光瀚健康集团，致力于将基因检测技术服务于大众健康',
    //         avatar: ''
    //     }
    // ]
    $scope.keyword = '';
    /*搜索*/
    $scope.search = function () {
        getOrgList();
    },
        $scope.searchKey = function ($event) {
            if ($event.keyCode == 13) {
                getOrgList();}
        }

    var params = {
        limit: 10,
        offset: 1,
    }
    //$scope.paging = {};
    $scope.pageNum = 1;
    $scope.hideShows = true;
    function getOrgList() {
        if ($scope.keyword) {
            params.keyword = $scope.keyword;
        }
        $fetch.fetch(
            api,
            {
                params: params,
            }
        ).then(function (data) {
            if (data) {
                $timeout(function () {
                    $scope.paging = data.page;
                    $scope.dataList = data.list;
                    //更新状态、数据加载控制
                    $scope._updated = 'reupdated';
                    $scope.hideShows = false;
                    //$scope.tagsT = data.productTags.slice(0, 4);
                    //$scope.tagsB = data.productTags.slice(4, 8);
                })
            }
        }).catch(function (e) {
            modalService(e.msg);
        })
    }
    getOrgList()
    /*翻页处理*/
    $scope.list = function () {
        params.offset = $scope.pageNum;
        if ($scope.keyword) {
            params.keyword = $scope.keyword;
        }
        $fetch.fetch(
            api,
            {
                params: params,
                cache: false,
            }
        ).then(function (data) {
            $timeout(function () {
                $scope.paging = data.page;
                //$scope.productList = data.rows;
                //if($scope.productList)
                $scope.dataList = $scope.dataList.concat(data.list);
                //更新状态、数据加载控制
                $scope._updated = 'updated';
                $scope.hideShows = false;
            })
        }).catch(function (e) {
            modalService.mainMsgError(e.msg);
        })
    }
    $scope.temple = '<li ng-repeat="item in dataList" class="item dfr aic " ui-sref="orgDetail({id:item.id})">   <div class="pic dfr aic"><img ng-src="{{item.avatar}}"></div>   <div class="dfc aifs itemR">     <div class="f16 c4c4 title">{{item.name}}</div>    <div class="c929 over-hide2">{{item.synopsis}}</div> </div></li>'
}])